package com.forever.disruptor;

import com.forever.entity.User;

@SuppressWarnings("unchecked")
public class DisruptorTest {

	public static void main(String[] args) {

		DisruptorHelper disruptorHelper = DisruptorHelper.getInstance(UserEvent.EVENT_FACTORY, new UserEventHandler());
		UserEventProducer producer = new UserEventProducer(disruptorHelper.getRingBuffer());

		for (long l = 0; true; l++) {
			User u = new User();
			u.setUserId(l + "");
			producer.produce(u);
			try {
				Thread.sleep(500);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}